package com.hnit.web.DTO;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.Data;
import lombok.NoArgsConstructor;



/**
 * 用户收货地址DTO
 */
@Data
@NoArgsConstructor
public class AddressDTO {

    /**
     * 地址ID
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long addressId;

    /**
     * 用户ID
     */
    @JsonSerialize(using = ToStringSerializer.class)
    @NotNull(message = "用户ID不能为空")
    private Long userId;

    /**
     * 收货人姓名
     */
    @NotBlank(message = "收货人姓名不能为空")
    @Size(max = 50, message = "收货人姓名长度不能超过50个字符")
    private String receiverName;

    /**
     * 收货人手机
     */
    @NotBlank(message = "收货人手机不能为空")
    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号码格式不正确")
    @Size(max = 20, message = "收货人手机长度不能超过20个字符")
    private String receiverMobile;

    /**
     * 省
     */
    @NotBlank(message = "省份不能为空")
    @Size(max = 50, message = "省份长度不能超过50个字符")
    private String province;

    /**
     * 市
     */
    @NotBlank(message = "城市不能为空")
    @Size(max = 50, message = "城市长度不能超过50个字符")
    private String city;

    /**
     * 区
     */
    @NotBlank(message = "区域不能为空")
    @Size(max = 50, message = "区域长度不能超过50个字符")
    private String district;

    /**
     * 详细地址
     */
    @NotBlank(message = "详细地址不能为空")
    @Size(max = 500, message = "详细地址长度不能超过500个字符")
    private String detailAddress;

    /**
     * 是否默认(0-否 1-是)
     */
    private Integer isDefault = 0;

    /**
     * 状态(0-被删除 1-正常)
     */
    private Integer addressStatus = 1;
}
